<template>
  <div class="container">
    <div class="suggest-header">搜索建议</div>
    <div class="suggest-list">
      <div  class="item"
            v-for="item of list"
            :key="item._id"
            @click="GetInfo(item)"
            >{{item}}</div>
    </div>
  </div>
</template>

<script>
import { mapMutations } from 'vuex'
export default {
  name: 'SearchList',
  props: {
    list: Array
  },
  methods: {
    GetInfo (city) {
      this.changeCity(city)
      this.$router.push('/')
    },
    ...mapMutations(['changeCity'])
  }
}
</script>

<style lang="stylus" scoped>
  @import '~styles/varibles.styl'
  @import '~styles/mixins.styl'
  .container
    position absolute
    top: .86rem
    right: 0
    left: 0
    width: 100%
    height: 100%
    .suggest-header
      height: .6rem
      line-height: .6rem
      padding-left: .2rem
    .suggest-list
      border-bottom: .02rem solid #ccc
      .item
        background: #fff
        height: .76rem
        line-height: .76rem
        padding-left: .2rem
        border-top: .02rem solid #ccc
</style>
